<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 基本表单</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="../favicon.ico">
    <link href="/Public/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link rel="stylesheet" href="/Public/css/ace.min.css" />
    <link href="/Public/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/css/animate.css" rel="stylesheet">
    <link href="/Public/css/style.css?v=4.1.0" rel="stylesheet">
    <style type="text/css">
        .span_right{
            float: right;
        }
        .down-menu{
            height: 35px;
            line-height: 35px;
        }
        .search_div{
            background: none;
            border: none;
            width: 450px !important;
        }
        .m-search{
            display: flex;
            margin-left: 30px;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>联络中心-
                        <small>外呼沟通记录</small>
                    </h5>
                    <div class="ibox-tools">
                        <volist name="roles" id="vr">
                            <if condition="$vr['name'] eq '创建外呼沟通记录'">
                                <a href="<{$SRVER_NAME}>/admin.php/ContactCenter/add_outbound_record" class="btn btn-info ">创建外呼沟通记录</a>
                            </if>
                        </volist>

                    </div>

                    <div class="ibox-tools">
                        <form method="get" action="<{$SRVER_NAME}>/admin.php/ContactCenter/outbound_record_list"  style="display: flex; margin-right: 50px;" class=" mail-search">

                            <div class="m-search" style="display: flex">
                                <input type="hidden" name="rid" value="<{$rid}>">
                                <input  class="form-control input-sm" type="text" name="feedback" placeholder="搜索事由、用户名、联系电话" value="<{$feedback}>"/>
                                <div class="input-group-btn">
                                    <button type="submit" class="btn btn-sm btn-primary">
                                        搜索
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="ibox-content">
                    <!--<form method="get" action="<{$SRVER_NAME}>/admin.php/ContactCenter/outbound_record_list"  style="display: flex;   margin-right: 30px;" class="pull-right mail-search">

                        <div class="m-search" style="display: flex">
                            <input type="hidden" name="rid" value="<{$rid}>">
                            &lt;!&ndash;  <input  class="form-control input-sm" type="text" name="feedback" placeholder="搜索文字反馈" value="<{$feedback}>"/> &ndash;&gt;
                            <div class="input-group-btn">
                                <button type="submit" class="btn btn-sm btn-primary">
                                    搜索
                                </button>
                            </div>
                        </div>
                    </form>-->
                    <table class="table table-striped table-bordered table-hover" id="sample-table">
                        <thead>
                        <tr>
                            <th>用户名称</th>
                            <th >联系电话</th>
                            <th> 委托部门</th>
                            <th>事由</th>
                            <th>
                                状态
                                <select  style="width: 100px" name="status" onchange="status(this.value)">
                                    <option value="0" <if condition="$status eq 0">selected</if> >全部</option>
                                    <option value="1" <if condition="$status eq 1">selected</if>>未沟通</option>
                                    <option value="2" <if condition="$status eq 2">selected</if>>已沟通</option>
                                    <option value="3" <if condition="$status eq 3">selected</if>>已完成</option>
                                </select>
                            </th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <volist name="data" id="vo" key="i">

                            <tr id="tr_<{$vo.id}>">
                                <td><{$vo.truename}></td>
                                <td><{$vo.moblie}></td>
                                <td><{$vo.apart_name}></td>
                                <td><{$vo.content}></td>
                                <td><{$vo.status}></td>
                                <td><{$vo.ctime}></td>
                                <td>
                                    <volist name="roles" id="vr">
                                        <if condition="$vr['name'] eq '查看详情'">
                                            <a href="<{$SRVER_NAME}>/admin.php/ContactCenter/outbound_record_details?id=<{$vo.id}>&status=<{$status}>&page=<{$page}>&rid=<{$rid}>&feedback=<{$feedback}>"  class="btn btn-success btn-rounded">查看详情</a>
                                        </if>
                                        <if condition="($vr['name'] eq '无人接听')and ($vo['status'] neq '已完成') ">
                                            <a href="javascript:;"  class="btn btn-info btn-rounded" onclick="content('<{$vo.id}>','无人接听')">无人接听</a>
                                        </if>
                                        <if condition="($vr['name'] eq '挂断') and ($vo['status'] neq '已完成') ">
                                            <a href="javascript:;"  class="btn btn-warning  btn-rounded" onclick="content('<{$vo.id}>','挂断')">挂断</a>
                                        </if>
                                        <if condition="($vr['name'] eq '停机') and ($vo['status'] neq '已完成') ">
                                            <a href="javascript:;"  class="btn btn-danger btn-rounded" onclick="content('<{$vo.id}>','停机')">停机</a>
                                        </if>
                                    </volist>

                                </td>
                            </tr>
                        </volist>


                        </tbody>
                    </table>
                    <div class="dataTables_paginate paging_simple_numbers" >
                        <ul class="pagination">
                            <if condition="$tol gt 10">
                                <{$fpage}>
                            </if>

                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/Public/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/Public/js/content.js?v=1.0.0"></script>
<script src="/Public/admin/js/layer/layer.js"></script>
<script>
    function status(value) {
        window.location.href='<{$SRVER_NAME}>/admin.php/ContactCenter/outbound_record_list?status='+value+'&rid=<{$rid}>'
    }
    //回复反馈
    function content(i,content) {
//加载loading层
        var index = layer.load(1, {
            shade: [0.1, '#fff'] //0.1透明度的白色背景
        });
        var id=i;
        var tourl = "<{$SRVER_NAME}>/admin.php/ContactCenter/outbound_record_details";
        var url = "<{$SRVER_NAME}>/admin.php/ContactCenter/add_outbound";
        var partten = /^(1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9]))\d{8}$/;
        if (content == "") {
            layer.close(index);
            layer.alert("回复不能为空！\r\n", {
                title: '提示框',
                icon: 0,
            });
            return false;
        }
        $.post(url, {
            o_id:id,
            content: content,
        }, function (data) {
            if (data.code == "1001") {
                var test = layer.alert(data.result, {title: '提示框', icon: 1}, function (index) {
                        window.location.href = "";
                    }
                );
            }
            else {
                layer.alert(data.result, {title: '提示框', icon: 0});
            }
        });
        layer.close(index);
    }

</script>
</body>
</html>
